import { defineConfig } from 'vite'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import vueJSX from '@vitejs/plugin-vue-jsx'
import eslint from '@rollup/plugin-eslint'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    {
      ...eslint({
        include: [ '**/*.+(vue|ts|tsx)', 'src/**/*.ts' ],
        fix: true
      }),
      enforce: 'pre'
    },
    vue(),
    vueJSX()
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
      'style-variables': resolve(__dirname, './src/themes/common/import.module.less')
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        additionalData: '@import "@/themes/common/import.module.less";',
        javascriptEnabled: true
      }
    }
  }
})
